/**
* @author attilax 1466519819@qq.com
* @version  c0
* Copyright 2013 attilax reserved.
* All content (including but not limited to text, pictures, etc.) have copyright restrictions, the note license.
* all the software source code  copyright belongs to the original owner.
* Creative Commons protocol use please follow the "sign for non-commercial use consistent"; we do not welcome the large-scale duplication, and all rights reserved.
* Commercial sites or unauthorized media may not copy software source code.
**/
 
 


 
package com.mijie.homi.search.service.user;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.mijie.homi.common.constant.MCKey;
import com.mijie.homi.common.domain.user.UserExtInfo;
import com.mijie.homi.search.dao.user.UserExtInfoDao;
import com.mijie.homi.search.service.MemcacheService;

@Service
/**
* @author attilax 1466519819@qq.com
* @version  c0
**/
public class UserExtInfoService {

	@Autowired
	private UserExtInfoDao dao;
	@Autowired
	private MemcacheService mcs;
	
	
/**
* @author attilax 1466519819@qq.com
* @version  c0
**/
	public UserExtInfo getUserExtInfoByUserId(int userId){
		UserExtInfo info = (UserExtInfo) mcs.get(MCKey.USER_EXTINFO_BY_ID, String.valueOf(userId));
		if(info==null){
			info =  dao.getUserExtInfoByUserId(userId);
			if(info!=null) mcs.set(MCKey.USER_EXTINFO_BY_ID, String.valueOf(userId), MCKey.USER_CACHE_TIMEOUT, info);
		}
		return info;
	}
}